package com.eobard.vo;

/**
 * @author Eobard_Thawne
 * @version 1.0
 * @date 2022/8/14 -18:32
 */

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

//路由信息的工具类:对应的是vue-element-admin的字段
/**  eg:
  {
       path: '/permission',
       component: Layout,              //父级菜单
       alwaysShow: true,            //一直显示根路由
       meta: { roles: ['admin','editor'] }, //你可以在根路由设置权限，这样它下面所有的子路由都继承了这个权限
       children: [{
         path: 'index',
         component: ()=>import('permission/index'),
         name: 'permission',
         meta: {
           title: 'permission',
           icon: 'lock', //图标
           roles: ['admin','editor'], //或者你可以给每一个子路由设置自己的权限
         }
        }]
    }
 */
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY) //不为空的时候就序列化
public class RouterVo {
    //路由地址
    private String path;

    //路由对应的组件
    private String component;

    //是否显示
    private boolean alwaysShow;

    //路由名称
    private String name;

    //路由meta信息
    private Meta meta;

    @Data
    @AllArgsConstructor
    public class Meta {
        private String title;//2级菜单标题
        private String icon;//图标
        private Object[] roles;//角色列表
    }

    //子路由
    private List<RouterVo> children = new ArrayList<RouterVo>();


}
